package _220325;


import java.util.Arrays;

/**
 * @author ShadowLim
 * @create 2022-03-25-9:06
 */
public class 找素数 {
    static int n = 100002;
    static boolean[] isPrime = new boolean[n * 13]; // n * 100 也可

    public static void main(String[] args) {
        Arrays.fill(isPrime, true);
        int len = isPrime.length;
        int ans = 0;
        for (int i = 2; i * i < len; i++) {
            if (isPrime[i]) {
                for (int j = i * i; j < len; j += i) { // j = i + i 也可以
                    isPrime[j] = false;
                }
            }
        }
        for (int i = 2; i < len; i++) {
            if (isPrime[i]) {
                n--;
            }
            if (n == 0) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);    // 1299743
    }
}
